<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数声明的方式</title>
</head>
<body>
    <script>
        // 第一种：一般写法
        function test() {
            console.log("hahahha");
        };
        test();

        // 第二种:表达式
        let title = function (tt) {
            console.log(tt);
        };
        title("你好");

        // 第三种
        let user = {
            name : '',
            setUsername(name) {
                this.name = name;
            },
            getUsername() {
                return this.name;
            }
        };
        user.setUsername("xiasnn");
        console.log(user.getUsername());
    </script>
</body>
</html>